package com.bootemp.mapper;

import com.bootemp.bean.Dept;
import com.bootemp.bean.Emp;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface EmpMapper {
    @Insert(value = "insert into emp values(default,#{ename}," +
            "#{tel},#{job},#{mgr},#{hiredate},#{sal}," +
            "#{comm},#{age},#{deptno},#{epic},#{epic2},#{econtent})")
    int insert(Emp e);
    @Select(value = "select * from emp")
    List<Emp> all(String path);
    @Delete(value = "delete from emp where empno=#{id}")
    int delete(int id);
    @Select(value = "select * from emp where empno=#{id}")
    Emp one(int id);
    @Update(value = "update emp set ename=#{ename},tel=#{tel}" +
            ",job=#{job},mgr=#{mgr}" +
            ",hiredate=#{hiredate},sal=#{sal}" +
            ",comm=#{comm},age=#{age}" +
            ",deptno=#{deptno},epic=#{epic}" +
            ",epic2=#{epic2},econtent=#{econtent}" +
            " where empno=#{empno}")
    int update(Emp e);
    @Update(value = "update emp set ename=#{ename},tel=#{tel}" +
            ",job=#{job},mgr=#{mgr}" +
            ",hiredate=#{hiredate},sal=#{sal}" +
            ",comm=#{comm},age=#{age}" +
            ",deptno=#{deptno}" +
            ",econtent=#{econtent}" +
            " where empno=#{empno}")
    int update2(Emp e);
    List<Emp> allEmp(String path);
    List<Dept> allDept(String path);
}
